<%@ page language="java" import="java.util.*, java.text.*,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.xy.manager.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*, com.zjut.zs.xy.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
	<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
		<title>无标题文档</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/select.css" rel="stylesheet" type="text/css" />
		<link href="css/city.css" rel="stylesheet" type="text/css" />
 		<script src='../plugins/assets/plugins/jquery-3.5.1.min.js'></script>
 		<script type="text/javascript" src="js/select-ui.min.js"></script>
	</head>

<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {

AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsXyManager xmanager = (ZsXyManager) SpringContextUtil.getBean("ZsXyManager");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsUserinfoManager uimanager = (ZsUserinfoManager) SpringContextUtil.getBean("ZsUserinfoManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);

ZsUserinfo userinfo = new ZsUserinfo();
ZsXy xy = new ZsXy();
ZsUser user = null;
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");	
} 	
if (user!=null) {
	xy.setZsUser(user);										
	List list = xmanager.getDataByInstance(1,1,null,null,xy).getObjects();
	if (list.size()>0) {
		xy = (ZsXy)list.get(0);
	}
	userinfo.setZsUser(user);										
	list = uimanager.getDataByInstance(1,1,null,null,userinfo).getObjects();
	if (list.size()>0) {
		userinfo = (ZsUserinfo)list.get(0);
	}
}
ZsUserStatus userStatus = smanager.getDataByUser(user);
 %>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="index.jsp">首页</a></li>
    <li><a href="#">补充信息</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    
    
    
    <ul class="forminfo">
    <div class="formtitle"><span>选考/学业水平</span></div>
    <li><label>选考科目<b>*</b></label>
    <div class="vocation">
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="政治" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("政治"))out.print("checked=true"); %> disabled>政治 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="历史" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("历史"))out.print("checked=true"); %> disabled>历史 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="地理" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("地理"))out.print("checked=true"); %> disabled>地理 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="物理" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("物理"))out.print("checked=true"); %> disabled>物理 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="化学" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("化学"))out.print("checked=true"); %> disabled>化学 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="生物" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("生物"))out.print("checked=true"); %> disabled>生物 </label>
    <label><input type="checkbox" name="xyXkIss" id="xyXkIss" value="技术" <%if(userinfo.getInXkkm()!=null&&userinfo.getInXkkm().contains("技术"))out.print("checked=true"); %> disabled>技术 </label>
    </div>
    <i></i></li>
    <li><div class="xline"></div></li>
    </ul>
    
    <form id="ff" name="add" role="form" class="form-horizontal" action="" method="post">
    <ul class="forminfo" style="clear:both;">
    <li><label>科目成绩<b>*</b></label>
    <div class="vocation">
    政治：<input disabled="disabled" id="xyXkZz" name="xyXkZz" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkZz()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    历史：<input disabled="disabled" id="xyXkLs" name="xyXkLs" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkLs()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    地理：<input disabled="disabled" id="xyXkDl" name="xyXkDl" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkDl()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    物理：<input disabled="disabled" id="xyXkWl" name="xyXkWl" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkWl()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    化学：<input disabled="disabled" id="xyXkHx" name="xyXkHx" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkHx()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    生物：<input disabled="disabled" id="xyXkSw" name="xyXkSw" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkSw()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    技术：<input disabled="disabled" id="xyXkJs" name="xyXkJs" type="text" class="smfinput" value="<%=html.getInputString(xy.getXyXkJs()) %>" data-rule-decimal150="true" data-msg-decimal150="请输入数字" />&nbsp;
    </div>
    <i></i></li>
	<li><div class="xline"></div></li>

    
    <li class="clear"><label>&nbsp;</label>
    <input id="xyXkIs" name="xyXkIs" type="text" class="dfinput" value="<%=xy.getXyXkIs() %>"  style="display:none;"/>
    <input id="xyId" name="xyId" type="text" class="dfinput" value="<%if(null==xy.getXyId()){out.print("");}else{out.print(xy.getXyId());}; %>" style="display:none;"/>
	<input id="zsUser.usId" name="zsUser.usId" type="text" class="dfinput" value="<%=xy.getZsUser().getUsId() %>"  style="display:none;"/>
	
	<%if(Status.APPSTATUS_NULL.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NO.getStatus().equals(userStatus.getAppStatus()) || Status.APPSTATUS_NOTIME.getStatus().equals(userStatus.getAppStatus())){ %>
	<button type="submit" class="btn btn-primary btn-sm">保存</button>
	<%} else {%>
	<button type="submit" class="btndisable" disabled>已确认</button>
	<%} %>
	
	</li>
    </ul>
    </form>
    
    </div>

<div style="margin:50px;width:500px;float:left;"><%out.print(anconfig.getSingleConfigInfoByName("选考学考填写需知")); %></div>


<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script> 
		

<script type="text/javascript">
var updateOneAction = '../zsXySave.action?randnum='+Math.floor(Math.random()*1000000);
var loactionurl = 'zs_xy.jsp';

$(document).ready(function(e) {
    $(".select1").uedSelect({
		width : 345			  
	});
	var checkBoxes = document.getElementsByName("xyXkIss");
	 for(var i=0;i<checkBoxes.length;i++){

  			if(checkBoxes[i].checked){
  				if(checkBoxes[i].value=="政治"){ $("#xyXkZz").removeAttr("disabled");}
			else if(checkBoxes[i].value=="历史"){$("#xyXkLs").removeAttr("disabled");}
			else if(checkBoxes[i].value=="地理"){$("#xyXkDl").removeAttr("disabled");}
			else if(checkBoxes[i].value=="物理"){$("#xyXkWl").removeAttr("disabled");}
			else if(checkBoxes[i].value=="化学"){$("#xyXkHx").removeAttr("disabled");}
			else if(checkBoxes[i].value=="生物"){$("#xyXkSw").removeAttr("disabled");}
			else if(checkBoxes[i].value=="技术"){$("#xyXkJs").removeAttr("disabled");}
  			}
  			
  		}
	
});



$(function(){
	
	//jquery.validate
	$("#ff").validate({				
		submitHandler: function() {
			var checkBoxes = document.getElementsByName("xyXkIss");
			var c=0;
			var a=new Array(3);
			for(var i=0;i<checkBoxes.length;i++){
				if(checkBoxes[i].checked){
					
					if(checkBoxes[i].value=="政治"){ a[c]=$("#xyXkZz").val();}
					else if(checkBoxes[i].value=="历史"){a[c]=$("#xyXkLs").val();}
					else if(checkBoxes[i].value=="地理"){a[c]=$("#xyXkDl").val();}
					else if(checkBoxes[i].value=="物理"){a[c]=$("#xyXkWl").val();}
					else if(checkBoxes[i].value=="化学"){a[c]=$("#xyXkHx").val();}
					else if(checkBoxes[i].value=="生物"){a[c]=$("#xyXkSw").val();}
					else if(checkBoxes[i].value=="技术"){a[c]=$("#xyXkJs").val();}
					c++;
				}
			}
			if (c<3 || ($("#xyXkZz").val()==''&&$("#xyXkLs").val()==''&&$("#xyXkDl").val()==''&&$("#xyXkWl").val()==''&&$("#xyXkHx").val()==''&&$("#xyXkSw").val()==''&&$("#xyXkJs").val()=='' )) {
			//if (c<3) {
				alert("选考科目必须选择3门并且把成绩填写完整！");
			} else {
				if((a[0]==''||a[1]==''||a[2]=='')){
					alert("选考科目必须选择3门并且把成绩填写完整！");
				}else{
				//验证通过后 的js代码写在这里
				submitFormAdvance();
				}
			}	
		  }					
		})
			    
})
		
$(function(){ //禁用单选
        $("input[type='checkbox']").click(function(){ 
            this.checked = !this.checked; 
        }); 
}); 	
	
function setValue(obj){


 var checkBoxes = document.getElementsByName("xyXkIss");
 var textfield = document.getElementById("xyXkIs");
 textfield.value="";
 var limit=3, c=0;
 for(var i=0;i<checkBoxes.length;i++){
 	
    if(checkBoxes[i].checked){
    	c++;
    	if (c>limit) {
    		alert("选考科目限选3门！");
    		obj.checked=false; 
    	} else {
    		textfield.value+=checkBoxes[i].value+",";
    	}       
    }
 }
 if(!obj.checked){
//console.log(obj.value);
	if(obj.value=="政治"){ $("#xyXkZz").val("");$("#xyXkZz").attr("disabled","disabled");}
	else if(obj.value=="历史"){ $("#xyXkLs").val("");$("#xyXkLs").attr("disabled","disabled");}
	else if(obj.value=="地理"){ $("#xyXkDl").val("");$("#xyXkDl").attr("disabled","disabled");}
	else if(obj.value=="物理"){ $("#xyXkWl").val("");$("#xyXkWl").attr("disabled","disabled");}
	else if(obj.value=="化学"){ $("#xyXkHx").val("");$("#xyXkHx").attr("disabled","disabled");}
	else if(obj.value=="生物"){ $("#xyXkSw").val("");$("#xyXkSw").attr("disabled","disabled");}
	else if(obj.value=="技术"){ $("#xyXkJs").val("");$("#xyXkJs").attr("disabled","disabled");}
} else if(obj.checked){
//console.log(obj.value);
	if(obj.value=="政治"){ $("#xyXkZz").removeAttr("disabled");}
	else if(obj.value=="历史"){$("#xyXkLs").removeAttr("disabled");}
	else if(obj.value=="地理"){$("#xyXkDl").removeAttr("disabled");}
	else if(obj.value=="物理"){$("#xyXkWl").removeAttr("disabled");}
	else if(obj.value=="化学"){$("#xyXkHx").removeAttr("disabled");}
	else if(obj.value=="生物"){$("#xyXkSw").removeAttr("disabled");}
	else if(obj.value=="技术"){$("#xyXkJs").removeAttr("disabled");}
}
 
}
		</script>
		
<%} %>		
</body>

</html>
